﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminMaster.master" AutoEventWireup="true" CodeBehind="Company.aspx.cs" Inherits="doris.Admin.Company" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h2>Firma</h2>
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        DataKeyNames="CompanyID" DataSourceID="SqlDataSource1" Height="50px" 
        Width="125px" CssClass="dorisDetail">
        <Fields>
            <asp:BoundField DataField="CompanyID" HeaderText="CompanyID" 
                InsertVisible="False" ReadOnly="True" SortExpression="CompanyID" 
                Visible="False" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="TicketPriorityID" HeaderText="TicketPriorityID" 
                SortExpression="TicketPriorityID" Visible="False" />
            <asp:CommandField ShowEditButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
        DeleteCommand="deleteCompany" DeleteCommandType="StoredProcedure" 
        InsertCommand="addCompany" InsertCommandType="StoredProcedure" 
        ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
        SelectCommand="getCompany" SelectCommandType="StoredProcedure" 
        UpdateCommand="storeCompany" UpdateCommandType="StoredProcedure" 
        oninserting="SqlDataSource1_Inserting" 
        onupdating="SqlDataSource1_Updating" oninserted="SqlDataSource1_Inserted">
        <DeleteParameters>
            <asp:Parameter Name="in_companyid" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="in_name" Type="String" />
            <asp:Parameter Name="in_ticketpriorityid" Type="Int32" />
        </InsertParameters>
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="in_companyid" 
                QueryStringField="id" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="in_companyid" Type="Int32" />
            <asp:Parameter Name="in_name" Type="String" />
            <asp:Parameter Name="in_ticketpriorityid" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
        SelectCommand="getUserByCompanyID" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="in_companyid" 
                QueryStringField="id" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <h3>Medlemmer</h3>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="UserID" DataSourceID="SqlDataSource2" CssClass="dorisGrid" AlternatingRowStyle-CssClass="alt">
        <Columns>
            <asp:BoundField DataField="Username" HeaderText="Username" 
                SortExpression="Username" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
        </Columns>
    </asp:GridView>
    <asp:HyperLink ID="HyperLink1" runat="server" 
        NavigateUrl="~/Admin/Companies.aspx">Tilbake</asp:HyperLink>
</asp:Content>
